#ifndef _RETRO_COLORPICKER
#define _RETRO_COLORPICKER

namespace Retro
{
  namespace Creator
  {
    namespace GUI
    {
      enum ColorPickerNotify
      {
        ColorPickerNotifySelection = 0x0001,
      };

      class ColorPicker : public GUI::Component
      {
      private:
        struct NumericItem
        {
          Label   label;
          WrapWnd edit;
          WrapWnd scroll;

          VOID  create(
            ColorPicker& iParent,
            INT       iID,
            PCTSTR    iText,
            INT       iMin,
            INT       iMax,
            INT       iIncrement
            );

          VOID  addToLayout(
            LayoutElement* iLayout,
            INT iTextWidth,
            INT iEditWidth
            );
        };

        GUI::ColorWheel   mColorWheel;
        GUI::ColorSlider  mValueSlider;
        GUI::ColorSlider  mAlphaSlider;
        NumericItem       mColorHue;
        NumericItem       mColorSat;
        NumericItem       mColorVal;
        NumericItem       mColorAlpha;
        LayoutElement     mLayout;
        HFONT             mFont;
        Gdip::Font        mTextFont;
        BOOL              mNoNotify;
        Geom::RGBColor    mColor;

        VOID  updateColor();

      protected:
        virtual VOID  onCreate(Event::WndCreateEvent& iEvent);
        virtual VOID  onDestroy();
        virtual VOID  onSize(Event::SizeEvent& iEvent);
        virtual VOID  onFocus(Event::FocusEvent& iEvent);
        virtual VOID  onNotify(Event::NotifyEvent& iEvent);
        virtual VOID  onCommand(Event::CommandEvent& iEvent);

      public:
        INL Geom::RGBColor  getColor()
        {
          return mColor;
        }

        VOID  setColor(COLOR iValue);

        ColorPicker();
      };
    } // namespace Toolbox
  } // namespace Creator
} // namespace Retro

#endif